# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import List
from fastapi import APIRouter, Depends
from hypertext import R, response_json
from apps.admin.schemas.market import recharge_schema as schema
from apps.admin.service.market.recharge_service import RechargeService

router = APIRouter(prefix="/recharge", tags=["充值套餐"])


@router.get("/lists", summary="充值套餐列表", response_model=R[List[schema.RechargePackageListVo]])
@response_json
async def lists():
    return await RechargeService.lists()


@router.get("/detail", summary="充值套餐详情", response_model=R[schema.RechargePackageDetailVo])
@response_json
async def detail(params: schema.RechargePackageDetailIn = Depends()):
    return await RechargeService.detail(params.id)


@router.post("/add", summary="充值套餐新增", response_model=R)
@response_json
async def add(params: schema.RechargePackageAddIn):
    return await RechargeService.add(params)


@router.post("/edit", summary="充值套餐编辑", response_model=R)
@response_json
async def edit(params: schema.RechargePackageEditIn):
    return await RechargeService.edit(params)


@router.post("/delete", summary="充值套餐删除", response_model=R)
@response_json
async def delete(params: schema.RechargePackageDeleteIn):
    return await RechargeService.delete(params.id)


@router.get("/get_config", summary="充值配置读取", response_model=R[schema.RechargeConfigIn])
@response_json
async def get_config():
    return await RechargeService.get_config()


@router.post("/set_config", summary="充值配置修改", response_model=R)
@response_json
async def set_config(params: schema.RechargeConfigIn):
    return await RechargeService.set_config(params)
